package pl.iachoo.ctl.tabory.ui.properties;

import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class Images {

	private static ImageRegistry imageRegistry;

	static {
		if (Display.getCurrent() != null) {
			imageRegistry = new ImageRegistry(Display.getCurrent());
		} else {
			throw new IllegalStateException(
					"ImageRegistry creation aborted! You are trying to retrieve an image while no display is available.");
		}
	}

	public static Image getImage(final String name) {
		return imageRegistry.get(name);
	}
}
